#include<stdio.h>


#define SIZE 10

int sum(int arr[], int n);

int main() {

    int nums[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    int result = sum(nums, SIZE);
    printf("The total number of nums is %d\n", result);
    printf("The size of nums is %zd bytes.\n", sizeof nums); // 40 bytes
    return 0;
}

int sum(int arr[], int n) {
    int i;
    int total = 0;
    for (i = 0; i < n; i++) {
        total += arr[i];
    }
    // That’s because arr is not an array itself; it is a pointer to the first element of marbles. Our system uses 8 bytes for
    // storing addresses, so the size of a pointer variable is 8 bytes.
    printf("The size of arr is %zd bytes\n", sizeof arr); // 8 bytes 
    return total;
}